<%@page language="java" contentType="text/html; charset=utf-8"	pageEncoding="utf-8"%>
<html>
<head>

<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript">
var listUrl="rest/stat/perS_VehicleDayList.do";
var recognizeStatusJson;         
 
$(document).ready(function () {

 
	/*  $('#month').combobox('setValue','11');//设置默认值为今年 */

    $("#submit-search").click(function () {
        $('#vehicle-recognize-dg').datagrid({ 
			queryParams : form2Json("fms")
			}); //点击搜索
		});

		$("#vehicle-recognize-dg").datagrid({
			loadMsg : '数据加载中....',
			//title: '用户管理',
			//height:document.body.clientHeight-60,
			width : '100%',
			url : listUrl,
			// 		loadFilter : function(result) {
			// 				if (result.retCode == '0000') {
			// 					return result.data;
			// 				} else {
			// 					return result.retMsg;
			// 				}
			// 			},
			nowrap : false,
			striped : true,
			remoteSort : false,
			rownumbers : true,
			pagination : true,
			fitColumns : true,
			pageList : [ 10, 15, 20, 25 ],
			frozenColumns : [ [ {
				field : 'id',
				checkbox : true
			}, {
				title : '编号',
				field : 'id',
				width : 0,
				hidden : 'true'
			} ] ],

			columns : [ [ 
			{
				field : 'day',
				title : '汇总日期',
				width : 30,
				formatter: function(value,row,index){
					return value.substring(0,10);
			    }
			}, 
			{
				field : 'scheduleNo',
				title : '排班编号',
				width : 30
			}, 
			{
				field : 'vehicleNo',
				title : '车辆编号',
				width : 30
			},
			{
				field : 'totalTimes',
				title : '总次数',
				width : 20
			}, {
				field : 'normalTimes',
				title : '正常次数',
				width : 20
			}
			, {
				field : 'failTimes',
				title : '替班次数',
				width : 20
			},{
				field : 'unTimes',
				title : '陌生人次数',
				width : 20
			}, {
				field : 'createTime',
				title : '创建时间',
				width : 30
			}
			

			] ]
		});// end datagrid
		//设置分页控件
		var p = $('#vehicle-recognize-dg').datagrid('getPager');
		$(p).pagination({
			pageSize : 10,//每页显示的记录条数，默认为10
			pageList : [ 10, 15, 20, 25 ],//可以设置每页记录条数的列表
			beforePageText : '第',//页数文本框前显示的汉字
			afterPageText : '页    共 {pages} 页',
			displayMsg : '当前显示 {from} - {to} 条记录   共 {total} 条记录',
			onBeforeRefresh : function() {
				$(this).pagination('loading');
				$(this).pagination('loaded');
			}

		});//end pagination

	})
	//end ready

	/* function stateChange(id,status){
		$.post("rest/recognizeUpdate.do",{"id":id,"status":status},function(data){
			if(data.retCode=="0000"){
				$('#vehicle-recognize-dg').datagrid("reload");
			}
		});
		
	} */
	
	function formatDatebox(value) {  
	    if (value == null || value == '') {  
	        return '';  
	    }  
	    var dt;  
	    if (value instanceof Date) {  
	        dt = value;  
	    } else {  
	        dt = new Date(value);  
	    }  
	  
	    return dt.format("yyyy-MM-dd"); //扩展的Date的format方法(上述插件实现)  
	}
	

	function addrecognize() {
		var url = "recognize/add.do";
		$.post(url, {}, function(data) {
			$("#center").empty();
			$("#center").html(data);
			$.parser.parse($("#center"));
		});
	}

	function showCenter(url, t) {
		var t = $(t);

		$.ajax({
			url : url,
			type : "get",
			beforeSend : function(XMLHttpRequest) {
				$("#center").html("<div class='loading'>页面加载中</div>");
			},
			success : function(data) {
				$("#center").empty();
				$("#center").html(data);
				$.parser.parse($("#center"));
				noword();
			}
		});
	}

	function editrecognize() {
		var rows = $('#vehicle-recognize-dg').datagrid('getSelections');
		if (rows.length != 1) {
			$.messager.alert('操作提示', "请先选择一条要编辑的信息！");
			return;
		}
		var row = $('#vehicle-recognize-dg').datagrid('getSelected');
		var id = row.id;
		var url = "recognize/edit.do";
		$.post(url, row, function(data) {
			$("#center").empty();
			$("#center").html(data);
			$.parser.parse($("#center"));
		});
	}

	function removerecognize() {
		var array = $('#vehicle-recognize-dg').datagrid('getSelections');
		var ids = new Array();

		for (var i = 0; i < array.length; i++) {//组成一个字符串，ID主键之间用逗号隔开

			ids[i] = array[i].id;
		}

		ids = ids.join(',');

		if (array != "") {
			$.messager.defaults = {
				ok : "确定",
				cancel : "取消"
			};
			$.messager.confirm('操作提示', '是否要删除该信息？', function(r) {
				if (r) {
					var host = location.host;
					$.post('rest/recognize/del.do', {
						ids : ids
					}, function(response) {

						if (response.retCode == "0000") {
							$('#vehicle-recognize-dg').datagrid('reload');
							$.messager.alert('操作提示', "删除成功", 'info');
						} else {
							$.messager.alert('操作提示', "删除失败", 'error');
						}
					});
				}
			});
		} else {
			$.messager.alert('操作提示', "请先选择要删除的信息！");
		}

	};
</script>
</head>
<body>



<!-- 		<div class="breadcrumb">系统 &gt;&gt; 用户管理</div> -->
		<!-- <div class="breadcrumb">系统 &gt;&gt; 用户管理</div> -->
		<div class="linkbar"><a>按排班和车辆每日识别统计</a></div>
		<div class="formtoolbar">
			<form id="fms" method="post" novalidate>
				<i>日期:</i> 
				<input class="easyui-datebox" data-options="required:false,showSeconds:false" name="day" style="width:150px" />
				<i>排班编号:</i> 
				<input name="scheduleNo" style="width:100px" />
				<i>车辆编号:</i> 
				<input name="vehicleNo" style="width:100px" />
				<a id="submit-search" class="easyui-linkbutton">搜索</a>						
			</form>
		</div>
	</div> 
		<div class="clear"></div>
		<div id="vehicle-recognize-dg" toolbar="#toolbar"></div>

		
</body>
</html>